var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("GameEm"),
    s = cc._decorator,
    c = s.ccclass,
    p =
        (s.property,
        s.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.checkCost = 0;
                e.parseKey = "";
                e.addReward = 0;
                e.shopData = null;
                e.rewardKind = r.RewardResKind.zhuanShi;
                e.spriteIcon = "";
                e.index = -1;
                e.sendLog = {
                    20201: "220201",
                    20202: "220202",
                    20203: "220203",
                    20204: "220204",
                    20205: "220205",
                    20206: "220206"
                };
                return e;
            }
            e.prototype.setItem = function (t, e, o) {
                this.index = t;
                this.shopData = e;
                this._tipLab1.$Label.string = "" + e.name;
                var a = e.products.split("_");
                SpriteView.setTaskSprite(this._coin1.$Sprite, e.icon);
                this.spriteIcon = o;
                this.parseKey = o;
                var i = parseInt(a[1]);
                if (PayData.isBuyData(this.index + "")) {
                    this._viewDouble.active = !1;
                    this.addReward = i;
                } else {
                    this.addReward = Math.floor(2 * i);
                    this._viewDouble.active = !0;
                    this._costLab.$Label.string = "" + Math.floor(2 * i);
                }
                this._newLab.$Label.string = "" + i;
                this.checkCost = parseInt(e.cash);
                this._costBtnLab.$Label.string = "￥" + this.checkCost;
            };
            e.prototype.checkSendKey = function () {
                var t = "" + this.sendLog[this.parseKey] || "";
                "" != t && QReport.send(t);
            };
            e.prototype._onTouchEnd = function () {
                var t = this;
                if (PayData.checkPayCost(this.checkCost)) {
                    var e = this._coin1.convertToWorldSpaceAR(cc.Vec2.ZERO);
                    cc.v2(e).add(cc.v2(-300, 700));
                    PayData.addPayData(
                        this.parseKey,
                        this.checkCost,
                        function (o) {
                            if (o) {
                                t.checkSendKey();
                                var a = {
                                    resId: t.parseKey,
                                    count: t.checkCost,
                                    type: 2,
                                    tip: "宝石获取",
                                    tip2: t.shopData.name
                                };
                                PayData.setIsBuy(t.index + "", !0);
                                PayData.addPropData(t.rewardKind, t.addReward, e);
                                EVUIEffView.emit(EVUIEffView.closeShop);
                                PayData.addLog(a.resId, a.count, a.type, [{id: 1, num: t.addReward}], a.tip, a.tip2);
                            }
                        },
                        [{id: 1, num: this.addReward}]
                    );
                } else console.log("ShopGroupItem01 ----------------- 价格不够");
            };
            return n([c], e);
        })(Thor));
o.default = p;
